var 
    appconfig = require('../utils/appconfig'),
    Q = require('q'),
    mongoose = require('mongoose');

var _schemas = require('./schema');

var _cfg = appconfig.getCfg();
var _mongo_url = 'mongodb://'+
  _cfg.mongodb.host+':'+_cfg.mongodb.port+'/'+_cfg.mongodb.db;

mongoose.connect(_mongo_url);

var _get = function(model){
  return mongoose.model(model);
}




var handlerError = function(error){
  return {code: 500, msg: error.toString()};
};

exports.handlerError = handlerError;
exports.get = _get;